package com.ruoyi.business.service;

import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.springframework.stereotype.Repository;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;

public interface IProcessService {

    /**
     * 根据上传文件进行部署
     *
     * @param filePath
     * @return
     * @throws IOException
     */
    Deployment deploy(String filePath) throws IOException;

    ProcessDefinition selectProcessDefinitionByDeploymentId(String deploymentId);

    InputStream getResourceAsStream(String deploymentId, String resourceName);

    InputStream getProcessImage(String processDefinitionId,
                                List<String> highLightActivities, List<String> highLightedFlows);

    ProcessInstance startProcessInstance(String definitionKey, String businessKey, HashMap<String, Object> variables);

    Task getTaskByProcessInstanceId(String instanceId);

    void addCandidateUser(Task currentTask, Long userId);

    List<String> getActiveActivityIds(String instanceId);

    ProcessInstance getProcessInstanceById(String instanceId);

    void deleteProcessInstance(String instanceId, String reason);

    long selectTodoTaskCount(String definitionKey, String candidateUser);

    List<Task> selectTodoTaskList(String definitionKey, String candidateUser, Integer startNum, Integer pageSize);

    Task getTaskByTaskId(String taskId);

    void claimAndCompleteTask(Task task, String userId, Boolean auditStatus, String commentStr);

    void setVariable(String taskId, String variableName, long variableValue);

    long selectDoneTaskCount(String definitionKey, String userId);

    List<HistoricTaskInstance> selectDoneTaskList(String definitionKey, String userId, Integer firstResult, Integer pageSize);

    HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId);

    List<HistoricActivityInstance> selectHistoryTaskList(String instanceId);

    String getTaskComment(String taskId);
}
